#include <stdio.h>
#include <stdlib.h>

int main() {
	int Z, n, i, f, s;

	scanf("%d", &Z);
	while(Z--) {
		scanf("%d", &n);
		f = 0;
		for(i = 0; i < n; i++) {
			scanf("%d", &s);
			f = f ^ s;
		}
		if(f == 0)
			printf("2\n");
		else
			printf("1\n");
	}

	return 0;
}
